public class TC2 {
    public static void main(String[] args) {
        TravelMethod travelMethod=new SelfDrivingTravel(7,1); //小轿车自驾七天游111
        travelMethod.showTravelInfo();
        System.out.println("旅行费用："+travelMethod.calculatePrice()+"元");
    }
}

abstract class TravelMethod {  //222
    protected int days;
    public TravelMethod(int days){
        this.days=days;
    }
    public abstract void showTravelInfo();
    public abstract double calculatePrice();
}

class SelfDrivingTravel extends TravelMethod{
    private int carType;
    public SelfDrivingTravel(int days,int carType){
        super(days);//333
        this.carType=carType;
    }
    public void showTravelInfo() {//444
        System.out.println("出行方式：自驾游");
        System.out.println("出行天数："+days);
        System.out.println("车型："+(carType==1?"小轿车" : "越野车"));
    }
    public double calculatePrice(){
        double basePrice = carType == 1 ? 500.0 : 800.0;
        double pricePerDay = carType == 1 ? 50.0 : 80.0;
        return basePrice + days * pricePerDay;

    }
}
